home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / usr_-_Usr_Files / INCLUDE / GNU-STAB.{1I < prev    next >
Text File  |  1999-09-17  |  5KB  |  149 lines

  1. /* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. #ifndef    __GNU_STABS_H
  20.  
  21. #define    __GNU_STABS_H    1
  22.  
  23. /* We will figure it out later. H.J. */
  24. #if !defined(__PIC__) && !defined(__pic__)
  25. #ifndef    HAVE_GNU_LD
  26. #define HAVE_GNU_LD
  27. #endif
  28. #endif
  29.  
  30. #if defined(HAVE_GNU_LD) && !defined(__ELF__)
  31.  
  32. /* Alias a function:
  33.        function_alias(creat, _creat, int, (file, mode),
  34.                DEFUN(creat, (file, mode),
  35.                      CONST char *file AND int mode))
  36.    Yes, this is very repetitive.  Nothing you can do about it, so shut up.  */
  37. #define    function_alias(name, _name, type, args, defun) \
  38.   symbol_alias (_name, name);
  39.  
  40. #define function_alias_void(name, _name, args, defun) \
  41.   symbol_alias (_name, name);
  42.  
  43. /* Make references to ALIAS refer to SYMBOL.  */
  44. #ifdef    __STDC__
  45. #define    symbol_alias(symbol, alias)    \
  46.   asm(".stabs \"" "_" #alias "\",11,0,0,0\n"\
  47.       ".stabs \"" "_" #symbol "\",1,0,0,0")
  48. #else
  49. /* Your assembler better grok this right!  */
  50. #define    symbol_alias(symbol, alias)    \
  51.   asm(".stabs \"_/**/alias\",11,0,0,0\n.stabs \"_/**/symbol\",1,0,0,0")
  52. #endif
  53.  
  54. /* Issue a warning message from the linker whenever SYMBOL is referenced.  */
  55. #ifdef    __STDC__
  56. #define    warn_references(symbol, msg)    \
  57.   asm(".stabs \"" msg "\",30,0,0,0\n"    \
  58.       ".stabs \"_" #symbol "\",1,0,0,0")
  59. #else
  60. #define    warn_references(symbol, msg)    \
  61.   asm(".stabs msg,30,0,0,0\n.stabs \"_/**/symbol\",1,0,0,0")
  62. #endif
  63.  
  64. #ifdef    __STDC__
  65. #define    stub_warning(name) \
  66.   warn_references(name, \
  67.           "warning: " #name " is not implemented and will always fail")
  68. #else
  69. #define    stub_warning(name) \
  70.   warn_references(name, \
  71.           "warning: name is not implemented and will always fail")
  72. #endif
  73.  
  74. #ifdef    __STDC__
  75. #define    text_set_element(set, symbol)    \
  76.   asm(".stabs \"_" #set "\",23,0,0,_" #symbol)
  77. #define    data_set_element(set, symbol)    \
  78.   asm(".stabs \"_" #set "\",25,0,0,_" #symbol)
  79. #else
  80. #define    text_set_element(set, symbol)    \
  81.   asm(".stabs \"_/**/set\",23,0,0,_/**/symbol")
  82. #define    data_set_element(set, symbol)    \
  83.   asm(".stabs \"_/**/set\",25,0,0,_/**/symbol")
  84. #endif
  85.  
  86. #else    /* No GNU stabs.  */
  87.  
  88. #define    function_alias(name, _name, type, args, defun) \
  89.   type defun { return _name args; }
  90.  
  91. #define function_alias_void(name, _name, args, defun) \
  92.   void defun { _name args; }
  93.  
  94. #endif    /* GNU stabs.  */
  95.  
  96. #ifdef __ELF__
  97.  
  98. /* Alias macros for ELF */
  99. #define elf_alias(name1, name2) \
  100.   __asm__(".globl " #name2 "; " #name2 "=" #name1)
  101. #define weak_alias(name1, name2) \
  102.   __asm__(".weak " #name2 "; " #name2 "=" #name1)
  103. #define weak_symbol(name) \
  104.   __asm__(".weak " #name)
  105.  
  106. /* Make SYMBOL, which is in the text segment, an element of SET.  */
  107. #if 1
  108. #define text_set_element(set, symbol)    _elf_text_set_element(set, symbol)
  109. #else
  110. #define text_set_element(set, symbol)
  111. #endif
  112.  
  113. /* Make SYMBOL, which is in the data segment, an element of SET.  */
  114. #define data_set_element(set, symbol)    _elf_data_set_element(set, symbol)
  115. /* Make SYMBOL, which is in the bss segment, an element of SET.  */
  116. #define bss_set_element(set, symbol)    _elf_data_set_element(set, symbol)
  117.  
  118. /* These are all done the same way in ELF.
  119.    There is a new section created for each set.  */
  120. #define _elf_text_set_element(set, symbol) \
  121.   static const void *const __elf_set_##set##_element_##symbol##__ \
  122.     __attribute__ ((section (#set))) = &(symbol)
  123.  
  124. #define _elf_data_set_element(set, symbol) \
  125.   static const void *__elf_set_##set##_element_##symbol##__ \
  126.     __attribute__ ((section (#set))) = &(symbol)
  127.  
  128. /* Define SET as a symbol set.  This may be required (it is in a.out) to
  129.    be able to use the set's contents.  */
  130. #define symbol_set_define(set)    symbol_set_declare(set)
  131.  
  132. /* Declare SET for use in this module, if defined in another module.  */
  133. #define symbol_set_declare(set) \
  134.   extern void *const __start_##set, *const __stop_##set;
  135.  
  136. /* Return a pointer (void *const *) to the first element of SET.  */
  137. #define symbol_set_first_element(set)    (&__start_##set)
  138.  
  139. /* Return true iff PTR (a void *const *) has been incremented
  140.    past the last element in SET.  */
  141. #define symbol_set_end_p(set, ptr)    ((ptr) >= &__stop_##set)
  142.  
  143. #define link_warning(msg) static const char __evoke_link_warning__[] \
  144.     __attribute__ ((section (".gnu.warning"))) = msg;
  145.  
  146. #endif
  147.  
  148. #endif    /* gnu-stabs.h  */
  149.